package project.dade.cn.bst.adapter.base;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;

import butterknife.InjectView;
import cn.bingoogolapple.androidcommon.adapter.BGAAdapterViewAdapter;
import cn.bingoogolapple.androidcommon.adapter.BGAViewHolderHelper;
import project.dade.cn.bst.R;
import project.dade.cn.bst.model.IndexInfoHots;

/**
 * Created by vain zhou on 2015/11/5.
 */
public class IndexNewsAdapter extends BGAAdapterViewAdapter<IndexInfoHots> {
    @InjectView(R.id.hotRL3Icon)
    ImageView imageView;


    public IndexNewsAdapter(Context context) {
        super(context, R.layout.item);

    }




    /**
     * 为item的孩子节点设置监听器，并不是每一个数据列表都要为item的子控件添加事件监听器，所以在父类中采用了空实现，需要设置事件监听器时重写该方法即可
     *
     * @param viewHolderHelper
     */
    @Override
    public void setItemChildListener(BGAViewHolderHelper viewHolderHelper) {
    }




    @Override
    protected void fillData(BGAViewHolderHelper viewHolderHelper, int position, IndexInfoHots model) {

        ImageView avatorIv =viewHolderHelper.getView(R.id.hotRL3Icon);
        Glide.with(mContext).load(model.getProductImage()).placeholder(R.drawable.image_loader_small).error(R.drawable.image_loader_small).into(avatorIv);

        viewHolderHelper.setText(R.id.hotRL3Title, model.getProductName());
        viewHolderHelper.setText(R.id.hotRL3Small,model.getSellPrice());

    }
}
